<?php
include_once('./common.php');
include_once(S_ROOT . '/data/action_config.php');
define('ADMIN_UID', 1);  //管理员ID
define('RIGHT_WIDTH', 210);  //宽度
checkclose();
$acs = array('index','today', 'city', 'hot', 'my', 'ing', 'finished', 'show','album','person','admin', 'add','modify','ajax', 'upload','invite');
foreach($acs as $v) $actives[$v] = '';
$ac = (!empty($_GET['ac']) && in_array($_GET['ac'], $acs)) ? $_GET['ac'] : 'index';
$actives[$ac] = ' class="active"';

if($ac != 'invite') checkuserlogin();

$uid = (int)$_SGLOBAL['supe_uid'];
if($uid > 0){
	getspace($uid);
	realname_set($_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']);
	updatetable('session', array('lastactivity' => $_SGLOBAL['timestamp']), array('uid'=>$_SGLOBAL['supe_uid']));
}

$ver = (float)X_VER;
if($ver == 1.5){
	if(X_VER != '1.5RC3') window_set("活动", 'action.php', 'image/app/action.gif');
}

//处理
include_once(S_ROOT."./action/{$ac}.php");

function checkuserlogin() {
	global $_SGLOBAL, $_SC;
	if(empty($_SGLOBAL['supe_uid'])) {
		if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){
			header('Content-type: text/xml; charset=' . $_SC['charset']);
			die('<?xml version="1.0" encoding="'.$_SC['charset'].'"?><root><![CDATA[\'{\'status\':404,\'message\':\'只有登陆后才能进行此步操作\'}\']]></root>');
		}else{
			ssetcookie('_refer', rawurlencode($_SERVER['REQUEST_URI']));
			showmessage('to_login', 'do.php?ac=login');
		}
	}
}
?>